import { useState } from 'react'
import {Theme} from '@/common/type'

export default function useTheme() {
  const [theme,setTheme]  = useState<Theme>('dark') // dark | light
  const setConfigTheme = () => {
    setTheme((x:Theme) => {
      if(x === 'light')  x = 'dark'
      else x = 'light'
      return x
    })
  }
  return {
    theme,
    setTheme,
    setConfigTheme
  }
}
